-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve unmarshalling and implement a RetryFunc #104
Conversation
c1e9de0
to
c9b0ac7
Compare
respBody, err := io.ReadAll(resp.Body) | ||
if err != nil { | ||
return false, fmt.Errorf("could not parse response body") | ||
} | ||
resp.Body.Close() | ||
respBody = bytes.TrimPrefix(respBody, []byte("\xef\xbb\xbf")) | ||
res := ErrorResponse{} | ||
if err = xml.Unmarshal(respBody, &res); err != nil { | ||
return false, err | ||
} | ||
resp.Body = io.NopCloser(bytes.NewBuffer(respBody)) | ||
if res.Code != nil { | ||
return strings.Contains(*res.Code, "ContainerBeingDeleted"), nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: it might be worth changing RetryFunc so that it's passed a client.Response
rather than an http.Response
, which would make common parsing a little cleaner. I can do that as part of this change if anyone thinks that's warranted? Or we could do that later when more RetryFuncs are added.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few minor points but otherwise LGTM 👍
go.mod
Outdated
github.com/hashicorp/go-azure-sdk/resource-manager v0.20240125.1111756 | ||
github.com/hashicorp/go-azure-sdk/sdk v0.20240125.1115017 | ||
github.com/hashicorp/go-azure-sdk/sdk v0.20240219.1162257-0.20240220115734-eeb1a5d96f9a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wants updating to a stable version
…p/go-azure-sdk/sdk` and v0.66.2 of `github.com/hashicorp/go-azure-helpers`
e57d964
to
dfec5fd
Compare
Depends on: hashicorp/go-azure-sdk#890